<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
  <title>Document</title>
  <style>
    .toast{
      width: 200px;
      height: 200px;
      background-color: azure;
    }
  </style>
</head>
<body>
  <div id="app">
    <div id="box"></div>
    <button @click="showToast">打开Toast</button>

    
    
    <teleport to="#box">
      <div v-if="show" class="toast">
        <h2>我是一个TOAST</h2>
      </div>
    </teleport>

  </div>

  <script>
    const { createApp, ref } = Vue

    createApp({
      setup() {
        const show = ref(true)

        const showToast = () => {

        }

        return {
          show,
          showToast
        }
      }
    }).mount('#app')
  </script>
</body>
</html>